package com.bird.extension.generic;

import java.util.Random;

/**
 * @Author: sijunqiang
 * @Date: 2020/3/29 13:05
 * @Description: 实现泛型接口
 */
public class RobotFactory implements GenericFactory<String, Integer> {
    //string类型数组

    private String[] stringRobot = new String[]{"hello", "world"};
    private Integer[] integerRobot = new Integer[]{111, 000};


    @Override
    public String nextObject() {
        Random random = new Random();
        return stringRobot[random.nextInt(2)];
    }

    @Override
    public Integer nextNumber() {
        Random random = new Random();
        return integerRobot[random.nextInt(2)];
    }

    public static void main(String[] args) {
        RobotFactory robotFactory = new RobotFactory();
        System.out.println(robotFactory.nextNumber());
        System.out.println(robotFactory.nextObject());

    }

}
